<!DOCTYPE html>
<html lang="en">

<head>
	<{include file="header.html" }>
		<title>面授课-课程管理-
			<{$user_data[ 'school_name']}>-德安信会计在线教育平台</title>
</head>

<body>
	<div class="wrap">
		<!--star left-->
		<div class="column">
			<{include file="left_menu.html" }>
		</div>
		<div id="ContMianBox">
			<!--star子栏目-->
			<div class="sub-colum">
                <div class="tit">课程管理</div>
                <ul>
                    <{if $is_manage == 1}><li><a href="/course">视频课</a></li><{/if}>
                    <li><a href="/course_zhibo">直播课</a></li>
                    <li class="curr"><a href="/course_banke">面授课</a></li>
                </ul>
            </div>
			<!--end子栏目-->
			<!--end left-->
			<div class="container narrow">
				<!--star conter-->
				<div class="cetContent">
					<div class="tit p-lr20">
						<span class="curr">面授课</span>
						<{if $is_manage == 1}><span><a href="/offline_course">面授课科目</a></span><{/if}>
						<{if $is_manage == 1}><span><a href="/offline_course/cate">面授课分类</a></span><{/if}>
					</div>
					<!--star内容区域-->
					<div class="mainScroll">
						<div class="mainContainer line-all">
							<!--star tabMainCont-->
							<div class="tabMainCont">
								<!--star会员管理-->
								<fieldset class="layui-elem-field">
									<legend>筛选</legend>
									<div class="layui-field-box">
										<form class="layui-form layui-form-pane1" action="/course_banke/index" method="post">
											<div class="layui-form-item">
												<div class="layui-input-inline">
	                                                <select name="category[cate_id]" class="abc" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
	                                                    <option value="">课程分类</option>
	                                                    <{foreach from=$cate item=item}>
	                                                        <option value="<{$item.id}>" <{if $conditions['cate_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
	                                                    <{/foreach}>
	                                                </select>
	                                            </div>
	                                            <div class="layui-inline">
	                                                <select name="category[kemu]" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
	                                                    <option value="">请选择科目</option>
	                                                     <{foreach from=$subject item=item}>
	                                                        <option value="<{$item.id}>" <{if $conditions['kemu']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.title}></option>
	                                                    <{/foreach}>
	                                                </select>
	                                            </div>

	                                            <div class="layui-inline">
	                                                <input type="text" name="category[name]" placeholder="搜索内容" value="<{if $conditions['name']}><{$conditions['name']}><{/if}>" class="layui-input">
	                                            </div>


												<div class="layui-inline">
													<button type="submit" class="layui-btn">搜索</button>
													<{if $is_manage == 1}><a class="layui-btn" href="/course_banke/publish"><i class="layui-icon"></i> 添加面授课</a><{/if}>
												</div>
											</div>
										</form>
									</div>
								</fieldset>
								<!--商品列表 star-->
								<div class="goods_list p-t10">
									<div class="mtc_tab">
										<!--star mt-->
										<div class="mt">
											<a href="/course_banke/index/10/<{$conditions['name']}>" <{if $conditions.status == 10}>class="curr"<{/if}>>全部</a>
											<a href="/course_banke/index/1/<{$conditions['name']}>" <{if $conditions.status == 1}>class="curr"<{/if}>>已上架</a>

											<a href="/course_banke/index/0/<{$conditions['name']}>" <{if $conditions.status == 0}>class="curr"<{/if}>>已下架</a>
										</div>
										<!--end mt-->
										<!--star mc-->
										<div class="mc">

											<div class="u_table_list m-t20">
												<!--star 商品-->
												<div class="table002">
													<table>
														<colgroup>
															<col width="5%">
															<col width="25%">
															<col width="%">
															<col width="%">
															<col width="%">
															<!-- <col width="%"> -->
															<col width="%">
														</colgroup>
														<tbody>
															<tr>
																<th>编号</th>
																<th>课程</th>
																<th>课时</th>
																<!-- <th>价格</th> -->
																<th>发布时间</th>
																<th>状态</th>
																<th>操作</th>
															</tr>
														</tbody>
														<tbody>
															<{foreach from=$course item=item}>
																<tr>
																	<td class="not_lb tal"><{$item['id']}></td>
																	<td class="not_lb tal">
																		<div class="product_name">
																			<div class="t_img"><img src="<{$item['course_img']}>" /></div>
																			<div class="t_info">
																				<a class="fs20" target="_blank" href="<{$school_info.url_web}>/banke/detail/<{$item['id']}>">
																					<{$item[ 'title']}>
																				</a>

																			</div>
																		</div>
																	</td>
																	<td class="not_lb tal"><{$item[ 'course_time']}>课时</td>
																	<!-- <td class="not_lb tal"><span class="c-ff6d5e">¥<{$item['price']|string_format:"%.2f"}>元</span></td> -->

																	<td class="not_lb tal">
																		<{$item[ 'add_time']|date_format: '%Y-%m-%d %H:%M:%S'}>
																	</td>
																	<td class="not_lb tal">
																		<div class="colorBtn">
																			<{if $item[ 'status']==0}>

																				<p><a id="sj_<{$item.id}>" href="javascript:void(0);" onclick="shangjia(<{$item.id}>)">已下架</a></p>
																				<{elseif $item[ 'status']==1}>
																					<p><a id="sj_<{$item.id}>" href="javascript:void(0);" onclick="shangjia(<{$item.id}>)">已上架</a></p>
																					<{/if}>
																		</div>
																	</td>
																	<td class="not_lb tal">
																		<div class="colorBtn">
																			<p><a href="/course_banke/edit/<{$item['id']}>">编辑</a></p>
																			<p><a onclick="javascript:return confirm('确定要删除该课程吗？');" href="/course_banke/del/<{$item['id']}>">删除</a></p>
																			<p><a onclick="javascript:;" href="/course/comment_list/<{$item['id']}>">查看评论</a></p>

																		</div>
																	</td>
																</tr>
																<{/foreach}>
														</tbody>
													</table>
												</div>
												<!--end 商品-->
											</div>
											<div class="pages p-tb20" style="text-align:right;">
												<{$pagination}>
											</div>
										</div>
										<!--end mc-->
									</div>

								</div>
								<!--商品列表 end -->
								<!--star会员管理-->
							</div>
							<!--end tabMainCont-->
						</div>

					</div>
				</div>

			</div>
		</div>
		<{include file="footer.html"}>
		<script>
        $(function() {
            layui.use(['form', 'layedit','jquery'], function() {
                var form = layui.form();

                //监听提交
                // form.on('submit(formDemo)', function(data) {
                //     layer.msg(JSON.stringify(data.field));
                //     return false;
                // });

	              form.on('select(cate_id)', function(data){
                    var ii = layer.load();
                    var id = data.value;

                    $("#kemu_list").html('');
                    form.render('checkbox');
                    $.ajax({
                        type: "POST",
                        url: "/course_banke/get_o2o_course_list_ajax/"+id,
                        dataType: "json",
                        success: function (data) {
                        	if(data==""){
                        		$("#kemu_list").html('<div class="layui-form-mid layui-word-aux">还没有课程科目，请<a href="/offline_course/course_add" class="c-52a1fa">添加课程科目</a></div>');
                        		// alert(data);
                        	}else{
	                            var ddl = $("#subject");
                                var html ='<option value="">请选择科目</option>';
                                $(data).each(function (key) {
                                    html += "<option value='"+data[key].id+"'>"+data[key].title+"</option>";
                                });
                                $("#subject").html(html);
                                form.render('select');
                        	}
                        	layer.close(ii);
                        }
                    });
                }); //ajax获取线下课程科目
            });



        })

				function shangjia(id){
				    $.ajax({
				        type: "POST",
				        url: "/course_banke/shangjia",
				        data: "id="+id,
				        async: false,
				        dataType: "json",
				        success: function(data) {
				          var t = $("#sj_"+id).text();
				          if(t=="已上架"){
				            $("#sj_"+id).text('已下架');
				          }else if(t=="已下架"){
				            $("#sj_"+id).text('已上架');
				          }

				        }
				    });
				}

        </script>
</body>

</html>
